<?php
/**
 * 获取每日考勤记录详情bll
 */
apf_require_class("Bll_BLL");
class Bll_Attendance_HistoryAnnual extends BLL{

    /**
     * 根据用户ID获取所有请假记录,用于我的考勤，检查是否在请假状态
     *
     * @param int $user_id
     * @access public
     * @return empty or int
     * @author coldarmy
     */
    public function get_history_annual_data($user_id) {
        $result = array();
        if(empty($user_id)) {
            return $result;
        }
        $where = array('user_id' => $user_id);
        $tmp = $this->get_app_dao()->find($where,'year desc',0,0);
        foreach ($tmp as $k => $v) {
            $result[$v['year']] = $v['annual'];
        }
        return $result;
    }

    /**
     * @return Dao_Attendance_HistoryAnnual
     */
    private function get_app_dao(){
        return $this->get_dao('Dao_Attendance_HistoryAnnual');
    }
}
